﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaiser.Models.InputModels;
using Kaiser.Models;
using Xoohoo.Models.InputModels;

namespace Kaiser.Repositories
{
    public interface IRepository<T> where T : class
    {
        T GetItem(Guid id);
        T Save(T item);
        bool Remove(Guid id);
        //IEnumerable<T> GetList(ISearchCriteria<T> searchCriteria, IDisplayOrder<T> displayOrder, PagingInfo pagingInfo);
    }
    public interface IRepository
    {
        #region  PermissionService
        Models.Permission GetPermissionItem(Guid id);
        Models.Permission GetPermissionItem(string name);
        List<Models.Permission> GetPermissionList();
        ModelResult Save(PermissionInput Input);
        ModelResult Save(IEnumerable<PermissionInput> Input);
        #endregion

        bool Remove(Guid id);
        bool Remove(IEnumerable<Guid> ids);

        #region RoleService
        Role GetRoleItem(Guid roleID);
        Role GetRoleItem(string roleName);
        List<RoleBasic> GetRoleList();
        ModelResult Save(RoleInput roleInput);
        #endregion

        #region UserGroupService 
        UserGroup GetUserGroupItem(Guid userGroupID);
        UserGroup GetUserGroupItem(string userGroupName);
        List<UserGroup> GetUserGroupList(Guid? parentID = null);
        ModelResult Save(UserGroupInput userGroupInput);
        #endregion 

        #region UserService
        User GetUserItem(int userID);
        User GetUserItem(string username);
        User GetUserItem(string username, UserStatus status);
        bool IsExists(string username);
        bool IsExists(int userId);
        bool ValidateUser(int userId, string username);
        DataGrid<UserBasic> GetUserBasicList(UserSearch criteria, PagingInfo pageingInfo);
        ModelResult SaveEdit(UserInputEdit userInput);
        ModelResult SaveAdd(UserInputAdd userInput);
        ModelResult Save(UserInput userInput);
        void SetPasswordByUserName(string username, string password);
        bool Remove(int userID);
        bool ChangeStatus(int userID, UserStatus status);
        bool SignIn(Func<User> getUser, Action<User> afterSignIn);
        void SignOut();

        #endregion

        #region SystemManageService
        #region 部门管理
        void InsertOrg(Kaiser.Models.Org model);
        void UpdateOrg(Kaiser.Models.Org model);
        DataGrid<Kaiser.Models.Org> GetSyncOrgTree(string deptid);
        void InsertUser(UserBasic model);
        void DeleteUser(string UserName);
        void UpdateUser(UserBasic mode);
        #endregion
        #endregion

        
    }
}
